package com.ocom.devicehttp.controller;

import com.ocom.common.constant.PayHandleUrl;
import com.ocom.common.utils.JsonResponse;
import com.ocom.devicehttp.service.TradePayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class TradePayController {

    @Autowired
    private TradePayService tradePayService;

    /*
     * @Description:支付请求（强在线）
     * @Author: lu 
     * @Date: 2022/4/28 16:49
     * @param map:  
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_OnlinePay)
    public JsonResponse onlinePay(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.onlinePay(map);
        return jsonResponse;
    }

    @PostMapping(PayHandleUrl.URL_OnlinePayB)
    public JsonResponse onlinePayB(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.onlinePayB(map);
        return jsonResponse;
    }

    /*
     * @Description:强在线订单查询
     * @Author: lu 
     * @Date: 2022/5/19 14:16
     * @param map:  
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_OnlineQuery)
    public JsonResponse onlineQuery(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.onlineQuery(map);
        return jsonResponse;
    }

    /*
     * @Description:交易中撤单
     * @Author: lu 
     * @Date: 2022/5/19 14:33
     * @param map:  
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_CancelOrder)
    public JsonResponse cancelOrder(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.cancelOrder(map);
        return jsonResponse;
    }

    /*
     * @Description:设备交易号退款
     * @Author: lu
     * @Date: 2022/5/19 15:04
     * @param map:
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_Refund)
    public JsonResponse refund(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.refund(map);
        return jsonResponse;
    }

    /*
     * @Description:账单列表查询
     * @Author: lu 
     * @Date: 2022/5/20 9:31
     * @param map:  
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_BillList)
    public JsonResponse billList(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.billList(map);
        return jsonResponse;
    }

    @PostMapping(PayHandleUrl.URL_MachQuery)
    public JsonResponse machQuery(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.machQuery(map);
        return jsonResponse;
    }

    @PostMapping(PayHandleUrl.URL_Balance)
    public JsonResponse Balance(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.Balance(map);
        return jsonResponse;
    }

    /*
     * @Description:消费记录
     * @Author: lu 
     * @Date: 2022/7/5 15:40
     * @param map:  
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_TradeRecord)
    public JsonResponse tradeRecord(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.tradeRecord(map);
        return jsonResponse;
    }

    @PostMapping(PayHandleUrl.URL_Deposit)
    public JsonResponse deposit(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.deposit(map);
        return jsonResponse;
    }


    @PostMapping(PayHandleUrl.URL_WX_Authinfo)
    public JsonResponse WXAuthinfo(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.WXAuthinfo(map);
        return jsonResponse;
    }



    /*
     * @Description: 3.17B支付请求（强在线-补缴版本）（0x0013，OnlinePayRepair）
     * @Author: 朱晖
     * @Date: 2024年1月12日15:48:10
     * @param map:
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_OnlinePayRepair)
    public JsonResponse OnlinePayRepair(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.OnlinePayRepair(map);
        return jsonResponse;
    }



    /*
     * @Description: 3.56 设备补缴（PayRepair,设备主动请求）
     * @Author: 朱晖
     * @Date: 2024年1月12日16:15:59
     * @param map:
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_PayRepair)
    public JsonResponse PayRepair(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.PayRepair(map);
        return jsonResponse;
    }



    /*
     * @Description: 3.57 设备补缴单查询（RepairQuery,设备主动请求）
     * @Author: 朱晖
     * @Date: 2024年1月13日11:12:31
     * @param map:
     * @return: com.ocom.common.utils.JsonResponse
     **/
    @PostMapping(PayHandleUrl.URL_RepairQuery)
    public JsonResponse RepairQuery(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.RepairQuery(map);
        return jsonResponse;
    }


    //3.56 设备上传掌纹注册信息（RegisterPalm）
    @PostMapping(PayHandleUrl.URL_RegisterPalm)
    public JsonResponse RegisterPalm(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.RegisterPalm(map);
        return jsonResponse;
    }

    //3.57 设备查询用户信息（personQuery）
    @PostMapping(PayHandleUrl.URL_personQuery)
    public JsonResponse personQuery(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.personQuery(map);
        return jsonResponse;
    }


    //设备支付方式
    @PostMapping(PayHandleUrl.URL_machineConsTypeConfig)
    public JsonResponse consTypeConfig(@RequestBody Map<String,Object> map) {
        JsonResponse jsonResponse=tradePayService.consTypeConfig(map);
        return jsonResponse;
    }
}
